/**  
* @Title: StockController.java  
* @Description: TODO(用一句话描述该文件做什么)  
* @author 张鑫
* @phone 17561783855  
* @date 2019年4月15日  
*/
package com.fortune.rainshineservice.controller;

import java.util.List;

import com.fortune.rainshinecommon.base.ParmsModel;
import com.fortune.rainshinecommon.query.StockQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.fortune.rainshinecommon.base.MsgModel;
import com.fortune.rainshinecommon.model.service.StockModel;
import com.fortune.rainshinecommon.model.service.StockRecordsModel;
import com.fortune.rainshineservice.service.StockService;

import javax.validation.Valid;

/**
 * @ClassName: StockController
 * @Description: TODO(库存操作逻辑)
 * @author 张鑫
 * @phone 17561783855
 * @date 2019年4月15日
 * 
 */
@RestController
@RequestMapping("/stock")
public class StockController {
	@Autowired
	private StockService stockService;

	@PostMapping("/addOrUpdate")
	public MsgModel addOrUpdate(@RequestBody StockModel stockModel) {
		return stockService.addOrUpdate(stockModel);
	}

	@PostMapping("/getStocks")
	public MsgModel getStockByShopId(@RequestBody String shopId) {
		return stockService.getStockByShopId(shopId);
	}
	
	@PostMapping("/getStocksForShopSale")
	public MsgModel getStocksForShopSale(@RequestBody String shopId) {
		return stockService.getStocksForShopSale(shopId);
	}
	
	@PostMapping("/getStocksForShopUse")
	public MsgModel getStocksForShopUse(@RequestBody String shopId) {
		return stockService.getStocksForShopUse(shopId);
	}
	
	@PostMapping("/warning")
	public boolean warning(@RequestBody StockModel model) {
		return stockService.warning(model);
	}
	
	@PostMapping(value = "/purchase")
	public MsgModel purchase(@RequestBody StockModel model) {
		return stockService.purchase(model);
	};
	
	@PostMapping(value = "/findDetailStocks")
	public List<StockRecordsModel> findDetailStocks(@RequestBody String id){
		return stockService.findDetailStocks(id);
	}

	@RequestMapping("/getStockList")
	public MsgModel getStockList(@RequestBody ParmsModel parms){
		return stockService.getStockList(parms);
	}
	
	@RequestMapping("/stockRecordDetail")
	public MsgModel stockRecordDetail(@RequestBody ParmsModel parms){
		return stockService.stockRecordDetail(parms);
	}

	@RequestMapping("/getSaleList")
	public MsgModel getSaleList(@RequestBody StockQuery query){
		return stockService.getSaleList(query);
	}

	@RequestMapping("/getConsumeList")
	public MsgModel getConsumeList(@RequestBody StockQuery query){
		return stockService.getConsumeList(query);
	}
}
